<!DOCTYPE html>
<html lang="en">
<head>
	<title>Navbar Template for Bootstrap</title>
          <?php include 'includes/header.php'; ?>
</head>
<body>
    
    <div class="container">
    
	<?php include 'includes/navbar.php';?>   

      <!-- Main component -->
	<div class="jumbotron">
	<h1>Add User</h1>
	<fieldset>
		<label>Name</label> 
		<input type="text" placeholder="Type something" id="name" /> <br> 
		<label>First Name :</label> 
		<input type="text" placeholder="Type something" id="firstName" /> <br> 
		<label>User Name :</label> 
		<input type="text" placeholder="Type something…" id="user" /> <br> 
		<label>Pass word :</label> 
		<input type="text" placeholder="Type something" id="pass" /><br>
		<button type="submit" class="btn btn-primary" id="savingUser">Saving</button>
	</fieldset>
	<div id="result">A</div>
	</div>

    </div> <!-- /container -->
    <?php include 'includes/footer.php';?>	
	
	<!-- scripts -->
	<script>
		$('#savingUser').click(function(){
			var values={
				"functionName" : 'addUser',                        
				"name"         :$("#name").val(),
				"firstName"    :$("#firstName").val(),
				"user"         :$("#user").val(),
				"pass"         :$("#pass").val()
		};

		$.ajax({
				url : "Controller.php",
				data : values,
				type : 'POST',
				success : function(response){
					$('#result').html(response.message);					
				},
				error : function(errorObject){ 
					$('#result').html(errorObject.responseText);					
				}
			});
		});
		
</script>
</body>
</html>
